#pragma once

#include "../Utility/Controller_PanelItem.h"

namespace UIStone
{
	class FCPanelItemBase : public FCController_PanelItem
	{
	protected:
	public:
		FCPanelItemBase (HWND hWndTopWindow) : m_hTopWindow(hWndTopWindow) {}
		~FCPanelItemBase() {};

	public:
		/// Get item's position on parent item.
		CPoint GetItemPosition() const;

		/// Get item's size.
		CSize GetItemSize() const;

		/// Force to redraw item.
		void UpdateObject() const;

		/// Get parent item.
		FCPanelItemBase* GetParent() const;

		/// Get topparent item.
		FCPanelItemBase* GetTopParent() const;

		/// Get window item on.
		HWND GetTopWindowHWND() const;

// 		/// Get specified item under current item.
// 		FCPanelItemBase* GetItemByID (int nID) const;

		BOOL IsPointInObjectRect (CPoint ptWnd) const;

		/// point on item ==> point on window.
		CPoint Item_to_TopWindow (CPoint ptObj) const;

		/// point on window ==> point on item.
		CPoint TopWindow_to_Item (CPoint ptWnd) const;

		//virtual void HandleWindowRgnMask (FCObjImage& imgMask32) ;

		virtual void OnPaint (CDC* pDC) {}

		/// Resize item.
		virtual void OnSize (CSize NewParentSize, CSize OldParentSize);

	private:
		HWND			 m_hTopWindow;
		FCPanelItemBase* m_pParentItem ;

		friend class FCPanelItemComposite ; // access 'm_pTopWindow'
	};
};

#include "PanelItemBase.inl"